class BCode(object):
     def __init__(self,text,code):
         self.text = text
         self.code = code
         
TOSS_FOOD_LOOKUP = { 'p':1,'z':2,'k':2,'t':2,'d':2,'s':1,'o':1,'l':6,'i':4,'x':2,'c':6,'v':3 }
             
TOSS_EXCLUDE_LIST = { 
        0x11c21: BCode('Pylon', 'P'),
        0x11ca1: BCode('Pylon', 'P'),
        0x11c42: BCode('Build Assimilator', 'E'),
        }
TOSS_LOOKUP = {
        #PEON BUILDING
        #0x6a01: 'Return cargo',
        0x11c20: BCode('Build Nexus','N'),
        0x11ca0: BCode('Build Nexus','N'),
        0x11c21: BCode('Pylon', 'P'),
        0x11ca1: BCode('Pylon', 'P'),
        0x11c23: BCode('Build Gateway','G'),
        0x11ca3: BCode('Build Gateway','G'),
        0x11c24: BCode('Build Forge', 'F'),
        0x11ca4: BCode('Build Forge', 'F'),
        0x11c25: BCode('Build Fleet Beacon', 'B'),
        0x11ca5: BCode('Build Fleet Beacon', 'B'),
        0x11c26: BCode('Build Twilight Council', 'T'),
        0x11ca6: BCode('Build Twilight Council', 'T'),
        0x11c27: BCode('Build Photon Cannon', 'C'),
        0x11ca7: BCode('Build Photon Cannon', 'C'),
        0x11c42: BCode('Build Assimilator', 'E'),
        0x11c29: BCode('Build Stargate', 'S'),
        0x11ca9: BCode('Build Stargate', 'S'),
        0x11c2a: BCode('Build Templar Archives', 'A' ),
        0x11caa: BCode('Build Templar Archives', 'A' ),
        0x11c2b: BCode('Build Dark Shrine', 'D'),
        0x11cab: BCode('Build Dark Shrine', 'D'),
        0x11c2c: BCode('Build Robotics Bay', 'R'),
        0x11cac: BCode('Build Robotics Bay', 'R'),
        0x11c2d: BCode('Build Robotics Facility', 'O'),
        0x11cad: BCode('Build Robotics Facility', 'O'),
        0x11c2e: BCode('Build Cybernetics Core', 'Y'),
        0x11cae: BCode('Build Cybernetics Core', 'Y'),
        
        #NEXUS
        0x12100: BCode('Train Probe', 'p'),
        0x3c00: BCode('Train Mothership', 'm'),
        #0x6640: 'Chrono Boost',
        
        #GATEWAY
        0x11e00: BCode('Train Zealot', 'z'),
        0x11e01: BCode('Train Stalker', 'k'),
        0x11e03: BCode('Train High Templar', 't'),
        0x11e04: BCode('Train Dark Templar', 'd'),
        0x11e05: BCode('Train Sentry', 's'),
        
        #WARP GATE
        0x14820: BCode('Warp in Zealot', 'z'),
        0x14821: BCode('Warp in Stalker', 'k'),
        0x14823: BCode('Warp in High Templar', 't'),
        0x14824: BCode('Warp in Dark Templar', 'd'),
        0x14825: BCode('Warp in Sentry', 's'),

        0x148a0: BCode('Warp in Zealot', 'z'),
        0x148a1: BCode('Warp in Stalker', 'k'),
        0x148a3: BCode('Warp in High Templar', 't'),
        0x148a4: BCode('Warp in Dark Templar', 'd'),
        0x148a5: BCode('Warp in Sentry', 's'),
        #FORGE UPGRADES
        
        0x12600: BCode('Ground Weapons Level 1', '1'),
        0x12601: BCode('Ground Weapons Level 2', '2'),
        0x12602: BCode('Ground Weapons Level 3', '3'),
        0x12603: BCode('Ground Armor Level 1', '4'),
        0x12604: BCode('Ground Armor Level 2','5'),
        0x12605: BCode('Ground Armor Level 3','6'),
        0x12606: BCode('Shield Level 1','7'),
        0x12607: BCode('Shield Level 2','8'),
        0x12608: BCode('Shield Level 3','9'),
        
        #CYBERNETICS UPGRADES
        0x15e00: BCode('Air Weapons Level 1', '!'),
        0x15e01: BCode('Air Weapons Level 2', '@'),
        0x15e02: BCode('Air Weapons Level 3','#'),
        0x15e03: BCode('Air Armor Level 1','$'),
        0x15e04: BCode('Air Armor Level 2','%'),
        0x15e05: BCode('Air Armor Level 3','^'),
        0x15e06: BCode('Warp Gate','&'),
        0x15e07: BCode('Hallucination','*'),
        0x15e09: BCode('Hallucination','('),
        0x12000: BCode('Warp Prism',')'),
        
        #ROBOTICS PRODUCTION
        0x12001: BCode('Observer', 'o'),
        0x12002: BCode('Colossus', 'l'),
        0x12003: BCode('Immortal', 'i'),

        #STARGATE UNITS
        0x11f00: BCode('Phoenix', 'x'),
        0x11f02: BCode('Carrier', 'r'),
        0x11f04: BCode('Void Ray', 'v'),
        
        #TWILIGHT UPGRADES
        0x15f00: BCode('Charge', '`'),
        0x15f01: BCode('Blink','~'),
        
        #FLEET BECON
        0x3701: BCode('Graviton Catapult','<'),
        

        #TEMPLAR UPGRADES
        #0x0: BCode('Khaydarin Amulet',
        0x12804: BCode('Psionic Storm','>'),

        #ROBO UPGRADES
        0x12701: BCode('Gravitic Booster','-'),
        0x12702: BCode('Gravitic Drive','_'),
        0x12705: BCode('Extended Thermal Lance','+'),
    }

    
    
class LOOKUP():
    abilities = {
        0x3601: 'Right click',
        0x5601: 'Right click in fog',
        0x2400: 'Stop',
        0x2403: 'Stop',
        0x2602: 'Hold position',
        0x2620: 'Move to',
        0x26a0: 'Move to',
        0x2640: 'Move to',
        0x2621: 'Patrol',
        0x26a1: 'Patrol',
        0x0: 'Follow',
        0x2400: 'Stop',   #Attackers can also stop
        0x2602: 'Hold position',
        0x2a20: 'Attack object',
        0x2a40: 'Attack object',
        0x2aa0: 'Attack move',
        0x2623: 'Scan move', # attack move for units without attack
        0x26a3: 'Scan move', # attack move for units without attack
        0x2643: 'Scan target', # attack move for units without attack
        0x6c00: 'Cancel',
        0x6c61: 'Cancel',
        0x6d00: 'Cancel',
        0x6d61: 'Cancel',
        0x6e00: 'Cancel',
        0x7000: 'Cancel',
        0x7100: 'Cancel',
        0x7101: 'Halt build',
        0x0: 'Cancel', # Generic ESC cancel
        0x0: 'Cancel unit', # Cancel + build id
        0x5820: 'Set rally point',
        0x5840: 'Set rally point',
        0x0: 'Set rally target',
        0x6d00: 'Cancel', # Generic ESC cancel
        0x0: 'Cancel unit', # Cancel + build id
        0x6940: 'Gather resources',
        0x6901: 'Return cargo',
        0x7200: 'Toggle Auto-Repair',
        0x7240: 'Repair',
        0xf30e: 'Halt',
        0x7320: 'Command Center',
        0x7321: 'Supply Depot',
        0x7323: 'Barracks',
        0x7324: 'Engineering Bay',
        0x7325: 'Missile Turret',
        0x7326: 'Bunker',
        0x7342: 'Refinery',
        0x7328: 'Sensor Tower',
        0x7329: 'Ghost Academy',
        0x732a: 'Factory',
        0x732b: 'Starport',
        0x732d: 'Armory',
        0x732f: 'Fusion Core',

        0x73a0: 'Command Center',
        0x73a1: 'Supply Depot',
        0x73a3: 'Barracks',
        0x73a4: 'Engineering Bay',
        0x73a5: 'Missile Turret',
        0x73a6: 'Bunker',
        0x73a2: 'Refinery',
        0x73a8: 'Sensor Tower',
        0x73a9: 'Ghost Academy',
        0x73aa: 'Factory',
        0x73ab: 'Starport',
        0x73ad: 'Armory',
        0x73af: 'Fusion Core',
        0x3a00: 'Toggle Auto-Repair',
        0x3a40: 'Repair',
        0x7500: 'Use Stimpack (mixed)',
        0x7500: 'Use Stimpack (mixed)',
        0x6200: 'Use Stimpack',
        0x3300: 'Hold fire',
        0x3400: 'Weapons free',
        0x16320: 'EMP Round',
        0x7740: 'Sniper Round',
        0x163a0: 'EMP Round',
        0x7800: 'Toggle Auto-Heal',
        0x7840: 'Heal',
        0x17c20: 'Auto Turret',
        0x3f20: 'Point Defense Drone',
        0x4b40: 'Seeker Missile',

        0x17ca0: 'Auto Turret',
        0x3fa0: 'Point Defense Drone',
        0x7e40: 'Yamato Cannon',
        0x5a20: 'Set rally point',
        0x5a40: 'Set rally target',
        0x10d00: 'Train SCV',
        0x4c40: 'MULE (Target)',
        0x4c20: 'MULE (Location)',
        0x6340: 'Extra Supplies',
        0x7d20: 'Scanner Sweep',

        0x4ca0: 'MULE (Location)',
        0x7da0: 'Scanner Sweep',
        0x11400: 'Hi-Sec Auto Tracking',
        0x11401: 'Building Armor',
        0x11402: 'Infantry Weapons Level 1',
        0x11403: 'Infantry Weapons Level 2',
        0x11404: 'Infantry Weapons Level 3',
        0x11405: 'Neosteel Frame',
        0x11406: 'Infantry Armor Level 1',
        0x11407: 'Infantry Armor Level 2',
        0x11408: 'Infantry Armor Level 3',
        0x11600: 'Arm silo with Nuke',
        0x11a00: 'Personal Cloaking',
        0x11a01: 'Moebius Reactor',
        0x3100: 'Salvage',
        0x16200: 'Salvage',
        0x17100: 'Stimpack',
        0x17040: 'Attack',
        0x17400: 'Stop',
        0x11b02: 'Vehicle Plating Level 1',
        0x11b03: 'Vehicle Plating Level 2',
        0x11b04: 'Vehicle Plating Level 3',
        0x11b05: 'Vehicle Weapons Level 1',
        0x11b06: 'Vehicle Weapons Level 2',
        0x11b07: 'Vehicle Weapons Level 3',
        0x11b08: 'Ship Plating Level 1',
        0x11b09: 'Ship Plating Level 2',
        0x11b0a: 'Ship Plating Level 3',
        0x11b0b: 'Ship Weapons Level 1',
        0x11b0c: 'Ship Weapons Level 2',
        0x11b0d: 'Ship Weapons Level 3',
        0x15d00: 'Weapon Refit',
        0x15d01: 'Behemoth Reactor',
        0x11100: 'Marine',
        0x11101: 'Reaper',
        0x11102: 'Ghost',
        0x11103: 'Marauder',
        0x11503: 'Nitro Packs',
        0x11700: 'Stimpack',
        0x11701: 'Combat Shields',
        0x11702: 'Concussive Shells',
        0x0: 'Cancel Research',
        0x0: 'Cancel specific Research',
        0x11201: 'Siege Tank',
        0x11204: 'Thor',
        0x11205: 'Hellion',
        0x11800: 'Siege Tech',
        0x11801: 'Infernal Pre-igniter',
        0x11802: '250mm Strike Cannons',
        0x0: 'Cancel Research',
        0x0: 'Cancel specific Research',
        0x11300: 'Medivac',
        0x11301: 'Banshee',
        0x11302: 'Raven',
        0x11303: 'Battlecruiser',
        0x11304: 'Viking',
        0x11900: 'Cloaking Field',
        0x11902: 'Caduceus Reactor',
        0x11903: 'Corvid Rector',
        0x11906: 'Seeker Missile',
        0x11907: 'Durable Materials',
        0x0: 'Cancel Research',
        0x0: 'Cancel specific Research',
        0x6a01: 'Return cargo',
        0x6a40: 'Gather resources',
        0x11c20: 'Nexus',
        0x11ca0: 'Nexus',
        0x11c21: 'Pylon',
        0x11ca1: 'Pylon',
        0x11c23: 'Gateway',
        0x11ca3: 'Gateway',
        0x11c24: 'Forge',
        0x11ca4: 'Forge',
        0x11c25: 'Fleet Beacon',
        0x11ca5: 'Fleet Beacon',
        0x11c26: 'Twilight Council',
        0x11ca6: 'Twilight Council',
        0x11c27: 'Photon Cannon',
        0x11ca7: 'Photon Cannon',
        0x11c42: 'Assimilator',
        0x11c29: 'Stargate',
        0x11ca9: 'Stargate',
        0x11c2a: 'Templar Archives',
        0x11caa: 'Templar Archives',
        0x11c2b: 'Dark Shrine',
        0x11cab: 'Dark Shrine',
        0x11c2c: 'Robotics Bay',
        0x11cac: 'Robotics Bay',
        0x11c2d: 'Robotics Facility',
        0x11cad: 'Robotics Facility',
        0x11c2e: 'Cybernetics Core',
        0x11cae: 'Cybernetics Core',
        0x14c20: 'Blink',
        0x14ca0: 'Blink',
        0x4000: 'Hallucinate Archon',
        0x4100: 'Hallucinate Colossus',
        0x4200: 'Hallucinate High Templar',
        0x4300: 'Hallucinate Immortal',
        0x4400: 'Hallucinate Phoenix',
        0x4500: 'Hallucinate Probe',
        0x4600: 'Hallucinate Stalker',
        0x4700: 'Hallucinate Void Ray',
        0x4800: 'Hallucinate Warp Prism',
        0x4900: 'Hallucinate Zealot',
        0x3900: 'Guardian Shield',
        0x15a20: 'Force Field',

        0x15aa0: 'Force Field',
        0x12220: 'Psionic Storm',
        0x122a0: 'Psionic Storm',
        0x3d40: 'Feedback',
        0x12500: 'Build Intercepter',
        0x16420: 'Vortex',
        0x3e20: 'Mass Recall',
        0x12100: 'Probe',
        0x3c00: 'Mothership',
        0x6640: 'Chrono Boost',
        0x5b40: 'Set rally point',
        0x5b20: 'Set rally target',
        0x11e00: 'Train Zealot',
        0x11e01: 'Train Stalker',
        0x11e03: 'Train High Templar',
        0x11e04: 'Train Dark Templar',
        0x11e05: 'Train Sentry',
        0x14820: 'Warp in Zealot',
        0x14821: 'Warp in Stalker',
        0x14823: 'Warp in High Templar',
        0x14824: 'Warp in Dark Templar',
        0x14825: 'Warp in Sentry',
        0x148a0: 'Warp in Zealot',
        0x148a1: 'Warp in Stalker',
        0x148a3: 'Warp in High Templar',
        0x148a4: 'Warp in Dark Templar',
        0x148a5: 'Warp in Sentry',
        0x12600: 'Ground Weapons Level 1',
        0x12601: 'Ground Weapons Level 2',
        0x12602: 'Ground Weapons Level 3',
        0x12603: 'Ground Armor Level 1',
        0x12604: 'Ground Armor Level 2',
        0x12605: 'Ground Armor Level 3',
        0x12606: 'Shield Level 1',
        0x12607: 'Shield Level 2',
        0x12608: 'Shield Level 3',
        0x15e00: 'Air Weapons Level 1',
        0x15e01: 'Air Weapons Level 2',
        0x15e02: 'Air Weapons Level 3',
        0x15e03: 'Air Armor Level 1',
        0x15e04: 'Air Armor Level 2',
        0x15e05: 'Air Armor Level 3',
        0x15e06: 'Warp Gate',
        0x15e07: 'Hallucination',
        0x15e09: 'Hallucination',
        0x12000: 'Warp Prism',
        0x12001: 'Observer',
        0x12002: 'Colossus',
        0x12003: 'Immortal',
        0x11f00: 'Phoenix',
        0x11f02: 'Carrier',
        0x11f04: 'Void Ray',
        0x15f00: 'Charge',
        0x15f01: 'Blink',
        0x3701: 'Graviton Catapult',
        0x0: 'Khaydarin Amulet',
        0x12804: 'Psionic Storm',
        0x12701: 'Gravitic Booster',
        0x12702: 'Gravitic Drive',
        0x12705: 'Extended Thermal Lance',

        0x13300: 'Drone',
        0x13301: 'Zergling',
        0x13302: 'Overlord',
        0x13303: 'Hydralisk',
        0x13304: 'Mutalisk',
        0x13306: 'Ultralisk',
        0x13309: 'Roach',
        0x1330a: 'Infestor',
        0x1330b: 'Corruptor',
        0x0: 'Cancel',
        0x12a01: 'Return cargo',
        0x0: 'Burrow',
        0x12920: 'Hatchery',
        0x12923: 'Spawning Pool',
        0x12924: 'Evolution Chamber',
        0x12925: 'Hydralisk Den',
        0x12926: 'Spire',
        0x12927: 'Ultralisk Cavern',
        0x12942: 'Extractor',
        0x12928: 'Infestation Pit',
        0x12929: 'Nydus Network',
        0x1292a: 'Baneling Nest',
        0x1292d: 'Roach Warren',
        0x1292e: 'Spine Crawler',
        0x1292f: 'Spore Crawler',

        0x129a0: 'Hatchery',
        0x129a3: 'Spawning Pool',
        0x129a4: 'Evolution Chamber',
        0x129a5: 'Hydralisk Den',
        0x129a6: 'Spire',
        0x129a7: 'Ultralisk Cavern',
        0x129a2: 'Extractor',
        0x129a8: 'Infestation Pit',
        0x129a9: 'Nydus Network',
        0x129aa: 'Baneling Nest',
        0x129ad: 'Roach Warren',
        0x129ae: 'Spine Crawler',
        0x129af: 'Spore Crawler',
        0x17620: 'Creep Tumor',
        0x176a0: 'Creep Tumor',
        0x6140: 'Larva',
        0x16740: 'Transfuse',
        0x3600: 'Explode',
        0x5e40: 'Attack Structure',
        0x3820: 'Fungal Growth',
        0x38a0: 'Fungal Growth',

        0x5f20: 'Infested Terran',
        0x5fa0: 'Infested Terran',
        0x5f20: 'Infested Terran',
        0x5fa0: 'Infested Terran',
        0x3200: 'Corruption',
        0x3240: 'Corruption',
        0x17500: 'Generate Creep',
        0x17501: 'Stop generating Creep',
        0x14522: 'Unload all at',
        0x5100: 'Changeling',
        0x20440: 'Contaminate',
        0x12b00: 'Evolve Melee Attacks Level 1',
        0x12b01: 'Evolve Melee Attacks Level 2',
        0x12b02: 'Evolve Melee Attacks Level 3',
        0x12b03: 'Evolve Ground Carapace Level 1',
        0x12b04: 'Evolve Ground Carapace Level 2',
        0x12b05: 'Evolve Ground Carapace Level 3',
        0x12b06: 'Evolve Missile Attacks Level 1',
        0x12b07: 'Evolve Missile Attacks Level 2',
        0x12b08: 'Evolve Missile Attacks Level 3',
        0x5d01: 'Evolve Glial Reconstitution',
        0x5d02: 'Evolve Tunneling Claws',
        0x15200: 'Evolve Centrifugal Hooks',
    }
